<!doctype html>
<html lang="zh">
<head>
	<meta http-equiv="content-type" content="text/html; charset=utf-8" />
	<title>我的网盘</title>
	<script type="text/javascript" src="__PUBLIC__/hdjs/jquery-1.11.3.min.js"></script>
    <link rel="stylesheet" href="__PUBLIC__/hdjs/hdjs.css"/>
    <link href="__PUBLIC__/css/mine.css" type="text/css" rel="stylesheet" />
	<link href="__PUBLIC__/css/smartMenu.css" type="text/css" rel="stylesheet" />
	<link href="__PUBLIC__/uploadify/uploadify.css" type="text/css" rel="stylesheet" />
    <script type="text/javascript" src="__PUBLIC__/hdjs/hdjs.min.js"></script>
    <script type="text/javascript" src="__PUBLIC__/js/popup_layer.js"></script>
    <script type="text/javascript" src="__PUBLIC__/js/jquery-smartMenu-min.js"></script>
	<script type="text/javascript" src="__PUBLIC__/uploadify/jquery.uploadify.min.js"></script>
</head>
<body>
	<div class="div_head">
		<span>
			<span style="float: left;">
				<empty name="info">
					<a href="{:U('index')}">
				<else /> 
					<a href="{:U('index',array('did'=>$info['pid']))}">
				</empty> 返回上层</a> | 
				<a href="{:U('index')}">我的网盘</a>
				<volist name='loc' id='v'>
					> <a href="{:U('index',array('did'=>$v['id']))}">{$v.name}</a>
				</volist>
			</span>
			<span style="float: right; margin-right: 8px; font-weight: bold;">
				<a id='cf' href="javascript:void('0');">【新建文件夹】</a>
			</span>
			<span style="float: right; margin-right: 8px; font-weight: bold;">
				<a id='uf' href="javascript:void('0');">【上传文件】</a>
			</span>
		</span>
	</div>
	<div style="font-size: 13px; margin: 10px 5px;padding:20px;position:relative;">
		<ul class="f_list">
			<volist name='f_list' id='l'>
			<li class="folder_b" id="{$l.id}">
				<a href="{:U('index',array('did' => $l['id']))}">
				<img src="__PUBLIC__/img/d.gif" alt="{$l.name}">
				<p>{$l.name}</p>
				</a>
			</li>
			</volist>
			<volist name='files' id='f'>
			<li class="file_b" id="{$f.fid}">
				<a href="{:U('download',array('fid' => $f['fid']))}">
				<img src="__PUBLIC__/img/f.gif" alt="{$f.fname}">
				<p>{$f.fname}</p>
				</a>
				<if condition="$f['isshare'] eq 1 ">
				<div class="s_ioc"></div>
				</if>
			</li>
			</volist>
		</ul>
		<div id="blk1" class="blk" style="display:none;">
            <div class="head"><div class="head-right"></div></div>
            <div class="main">
                <h2>输入文件夹名，然后确定</h2>
                <a href="javascript:void(0)" id="close1" class="closeBtn">关闭</a>
                <div class="form_box">
               <form class="hd-form" action="{:U('mkdir')}" method="post" >
               	<input type="hidden" name="pid" <empty name="info"> value="0" <else /> value= "{$info.id}"</empty> />
               	<input type="text" name="filename" class="hd-h30 hd-w300"/>
               	<input class="hd-btn-primary hd-btn-sm" type="submit" value="确定">
               </form>
               </div>
            </div>
            <div class="foot"><div class="foot-right"></div></div>
        </div>
        <div id="blk2" class="blk" style="display:none;">
            <div class="head"><div class="head-right"></div></div>
            <div class="main">
                <h2>点文件上传，选择要上传的文件，上传完成后点关闭</h2>
                <a href="javascript:void(0)" id="close2" class="closeBtn">关闭</a>
                <div class="form_box">
               <form>
					<div id="queue"></div>
					<input id="file_upload" name="file_upload" type="file" multiple="true">
				</form>
               </div>
            </div>
            <div class="foot"><div class="foot-right"></div></div>
        </div>
	</div>
	
	<script language="javascript">
	$(document).ready(function() {
		new PopupLayer({trigger:"#cf",popupBlk:"#blk1",closeBtn:"#close1",
			offsets:{
				x:-800,
				y:100
			}
		});
		new PopupLayer({trigger:"#uf",popupBlk:"#blk2",closeBtn:"#close2",
			offsets:{
				x:-800,
				y:100
			}
		});
		$('#close2').click(function() {
			location.reload();
		});

	});
	var folderdata = [
			[{
				text:"打开",
				func:function() {
					var id = $(this).attr("id");
					window.location = "__ACTION__/did/"+id;
				}
			}],
			[{
				text:"删除",
				func:function() {
					var id = $(this).attr("id");
					hd_ajax("{:U('deld')}", {did:id}, "__SELF__");
				}
			}]
		];
		$(".folder_b").smartMenu(folderdata,{name:"folder"});
		var filedata = [
			[{
				text:"设为共享",
				func:function() {
					var id = $(this).attr("id");
					hd_ajax("{:U('sharef')}", {fid:id,share:1}, "__SELF__");
				}
			}],
			[{
				text:"取消共享",
				func:function() {
					var id = $(this).attr("id");
					hd_ajax("{:U('sharef')}", {fid:id,share:0}, "__SELF__");
				}
			}],
			[{
				text:"删除",
				func:function() {
					var id = $(this).attr("id");
					hd_ajax("{:U('delf')}", {fid:id}, "__SELF__");
				}
			}]
		];
	
	$(".file_b").smartMenu(filedata,{name:"file"});
	</script>
	<script>
		$('#file_upload').uploadify({
				'formData'     : {
					'did'     : '{$info.id}',
					'uid'     : '{$Think.session.mg_id}'
				},
				'swf'      : '__PUBLIC__/uploadify/uploadify.swf',
	        	'uploader' : '{:U("upload")}',   //上传的方法
	        	'buttonText' : '文件上传',
    	});
    </script>
</body>
</html>